import { createApp } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';
import MonitorSdk, { monitorSdk } from './../../../lib/index.esm';

import App from './App.vue';
MonitorSdk({
	pId: '1000', // 产品ID
	reportUrl: 'http://127.0.0.1:9001/report', // 上报的地址
	debug: true, // 是否开启debug，开启后打印控制台不上报
	jsErrorLog: true, // js异常
	promiseErrorLog: true, // promise异常
	resourcesErrorLog: true, // 资源加载异常
	exposureLog: true, //  // 曝光
	automaticBurialPointLog: true, // 自动埋点
	pageDwellTimeLog: true, // 页面停留时间
	pvLog: true, // PV
	xhrLog: true, // 接口监控
	longTaskLog: true, // 长任务
	resourcesPerfLog: true, // 资源加载性能
	perfLog: true, // 页面渲染性能
	behaviorRecorderLog: true, // 用户行为录制
});
setTimeout(() => {
	monitorSdk.report({
		type: 'custom',
		data: 'hulei',
	});
}, 1000);
// eslint-disable-next-line no-undef
const router = createRouter({
	history: createWebHistory(),
	routes: [
		{ path: '/', component: () => import('./views/Home.vue') },
		{ path: '/jsError', component: () => import('./views/JsError.vue') },
		{
			path: '/promiseError',
			component: () => import('./views/PromiseError.vue'),
		},
		{
			path: '/resourcesError',
			component: () => import('./views/ResourcesError.vue'),
		},
		{
			path: '/exposure',
			component: () => import('./views/Exposure.vue'),
		},
		{
			path: '/automaticBurialPoint',
			component: () => import('./views/AutomaticBurialPoint.vue'),
		},
		{
			path: '/xhr',
			component: () => import('./views/Xhr.vue'),
		},
		{
			path: '/longTask',
			component: () => import('./views/LongTask.vue'),
		},
		{ path: '/perf', component: () => import('./views/Perf.vue') },

		{
			path: '/behaviorRecorder',
			component: () => import('./views/BehaviorRecorder.vue'),
		},
	],
	scrollBehavior() {
		return {
			top: 0,
			behavior: 'smooth',
		};
	},
});
let app = createApp(App);
app.use(router).mount('#app');
